package com.handsome.中介者模式;

/**
 * @author niechun
 * @date 2023/3/19 17:34
 */
public class TelColleague extends Colleague{

    public TelColleague(Mediator mediator, String name) {
        super(mediator, name);
        mediator.register(name,this);
    }

    @Override
    public void sendMessage(int stateChange) {
        this.getMediator().getMessage(stateChange,getName());
    }


    public void control(int stateChange) {
        sendMessage(stateChange);
    }

    public void off() {
        System.out.println("电视开启");
    }

    public void on() {
        System.out.println("电视关闭");
    }

}
